package org.lemon.cla.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.EnumValue; // 导入 EnumValue 注解
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.lemon.cla.enums.NewsCategoryEnum;

import java.time.LocalDateTime;

@Data
@TableName("news")
@Schema(description = "新闻实体")
public class News {

    @TableId(value = "news_id", type = IdType.AUTO)
    @Schema(description = "新闻ID", example = "1")
    private Long newsId;

    @Schema(description = "标题", example = "学校图书馆新增图书")
    private String title;

    @TableField("cover_url")
    @Schema(description = "封面URL", example = "http://example.com/cover.jpg")
    private String coverUrl;

    @Schema(description = "新闻内容", example = "详细新闻内容...")
    private String content;

    @TableField("publisher_id")
    @Schema(description = "发布者ID (管理员)", example = "101")
    private Long publisherId;

    @TableField("publish_time")
    @Schema(description = "发布时间", example = "2023-10-26T10:00:00")
    private LocalDateTime publishTime;

    @Schema(description = "新闻类别", example = "学术", allowableValues = {"学术", "事件", "通知"})
    private NewsCategoryEnum category; // 直接使用枚举类型

    @TableField("view_count")
    @Schema(description = "浏览次数", example = "1500")
    private Integer viewCount;
}